home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hobby PC 28
/
Hobby PC 28.iso
/
MicrografxMM
/
FlowCharter
/
Autosamp
/
ORGCHART.FRM
< prev
next >
Wrap
Text File
|
1997-03-04
|
26KB
|
755 lines
VERSION 4.00
Begin VB.Form OrgChartDlg
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Organization Chart DEMO"
ClientHeight = 1815
ClientLeft = 465
ClientTop = 1755
ClientWidth = 5535
FillColor = &H00C0C0C0&
FillStyle = 0 'Solid
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 2220
Icon = "ORGCHART.frx":0000
Left = 405
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 1815
ScaleWidth = 5535
Top = 1410
Width = 5655
Begin VB.CommandButton OptionsBtn
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Options..."
Height = 375
Left = 4080
TabIndex = 5
Top = 720
Width = 1335
End
Begin VB.CommandButton CancelBtn
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Cancel"
Height = 375
Left = 2820
TabIndex = 4
Top = 1320
Width = 1335
End
Begin VB.CommandButton BrowseBtn
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Browse..."
Height = 375
Left = 4080
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.CommandButton OKBtn
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "OK"
Default = -1 'True
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 2
Top = 1320
Width = 1335
End
Begin VB.TextBox OrgChartTextFileEdit
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 285
Left = 120
TabIndex = 1
Top = 600
Width = 3675
End
Begin MSComDlg.CommonDialog OrgChartBrowse
Left = 360
Top = 1320
_Version = 65536
_ExtentX = 847
_ExtentY = 847
_StockProps = 0
End
Begin AbcflowLib.ABC ABC1
Height = 375
Left = 4560
TabIndex = 6
Top = 1320
Width = 495
_version = 65536
_extentx = 873
_extenty = 661
_stockprops = 1
End
Begin VB.Line Line6
BorderColor = &H00808080&
X1 = 0
X2 = 5520
Y1 = 1800
Y2 = 1800
End
Begin VB.Line Line5
BorderColor = &H00808080&
X1 = 5520
X2 = 5520
Y1 = 1800
Y2 = 0
End
Begin VB.Line Line4
BorderColor = &H00FFFFFF&
X1 = 5520
X2 = 0
Y1 = 0
Y2 = 0
End
Begin VB.Line Line3
BorderColor = &H00FFFFFF&
X1 = 0
X2 = 0
Y1 = 1800
Y2 = 0
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = 0
X2 = 5520
Y1 = 1210
Y2 = 1210
End
Begin VB.Line Line1
BorderColor = &H00808080&
X1 = 0
X2 = 5520
Y1 = 1200
Y2 = 1200
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "ASCII Text File:"
ForeColor = &H80000008&
Height = 255
Left = 120
TabIndex = 0
Top = 360
Width = 2055
End
End
Attribute VB_Name = "OrgChartDlg"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Dim ABC As Object
Dim FormatIter As Integer
Dim LoopIter As Integer
Dim TotalFormatIter As Integer
Dim req_objs As Integer
Private Sub ABC1_AppQuitNOTIFY()
End
End Sub
Private Sub BrowseBtn_Click()
OrgChartBrowse.Action = 1
' OrgChartBrowse.Filename = OrgChartTextFileEdit.Text
OrgChartTextFileEdit.Text = LCase(OrgChartBrowse.Filename)
OrgChartBrowse.Filename = "*.txt"
End Sub
Private Function CalcPercent() As Integer
CalcPercent = 100 * ((LoopIter / req_objs) / TotalFormatIter + (FormatIter - 1) / TotalFormatIter) + 1
If CalcPerent > 100 Then CalcPercent = 100
If CalcPerent < 0 Then CalcPercent = 0
LoopIter = LoopIter + 1
End Function
Private Sub CancelBtn_Click()
Unload OrgChartDlg
End Sub
Private Sub Command2_Click()
OrgChartBrowse.Action = 1
End Sub
Private Function DoCreateOrgChart(ByVal Filename As String) As Integer
Dim OrgItem As String
Dim Chart As Object
Dim cur_pos As Integer
Dim len_str As Integer
Rem Make a new chart
Set Chart = ABC.New
Rem Set the right shape palette
Chart.CurrentShapePalette = "Standard"
Chart.CurrentShape = "Process"
ABC.ShapePaletteVisible = False
Rem Set the Chart's internal type
Chart.Type = "PROCESS"
Rem Turn off master items
Chart.MasterItems.Hideall
Chart.DrawDirection = 2
Chart.DrawPositionX = 4
Chart.DrawPositionY = 1
Chart.DrawSpacingY = 0.25
Chart.CurrentLineRouting = 3
If OrgChartOptionsDlg.TopToBottomRBtn.Value = True Or OrgChartOptionsDlg.BottomToTopRBtn = True Then
vertical = True
Else
vertical = False
End If
If OrgChartOptionsDlg.BottomToTopRBtn.Value = True Or OrgChartOptionsDlg.RightToLeftRBtn = True Then
inverted = True
Else
inverted = False
End If
If vertical Then
Chart.PageLayout.Orientation = 1
Else
Chart.PageLayout.Orientation = 0
End If
Chart.NoRepaint = True
len_file = FileLen(Filename)
If len_file < 32767 And len_file > 0 Then
Dim EntireFile As String
Dim test_ascCode As Integer
Dim rank As Integer
Dim index As Integer
Dim cur_obj_count As Integer
Dim num_levels As Integer
Open Filename For Binary Access Read As #1
EntireFile = String$(len_file, " ")
Get #1, , EntireFile
Close
Rem Set up the progess bar
ABC.PercentGauge "Organization Chart DEMO", "PASS 1 of 2: Reading & parsing file..."
DrawnCount = 0
req_objs = GetNumLines(EntireFile) + 1
ReDim ShapeList(req_objs) As Object
ReDim ShapeRefStack(req_objs) As Integer
ReDim RelationMap(req_objs, 3) As Integer
Const first_child = 1, next_sibling = 2, parent = 3
cur_pos = 1
index = 2
cur_obj_count = 1
ShapeRefStack(1) = 1
Do While cur_pos < len_file + 1